//package com.yc.bran.snack.controller;  
//
//import java.io.IOException;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.web.bind.annotation.GetMapping;  
//import org.springframework.web.bind.annotation.PostMapping;  
//import org.springframework.web.bind.annotation.RequestMapping;  
//import org.springframework.web.bind.annotation.RestController;
//
//import com.alipay.api.AlipayApiException;
//import com.alipay.api.AlipayClient;
//import com.alipay.api.DefaultAlipayClient;
//import com.alipay.api.request.AlipayTradePagePayRequest;
//
//import cn.hutool.core.util.RandomUtil;  
//
//// ... 其他必要的导入 ...  
//
//@RestController  
//@RequestMapping("/alipay")  
//public class AlipayController {  
//	@RequestMapping("/paytest")
//	@IgnoreAuth
//	public void alipay (HttpServletRequest httpRequest,
//			HttpServletResponse httpResponse)   throws IOException {
//
//		//获得初始化的AlipayClient
//		AlipayClient alipayClient =  new DefaultAlipayClient( Constant.URL , Constant.APP_ID, Constant.APP_PRIVATE_KEY, Constant.FORMAT,
//				Constant.CHARSET, Constant.ALIPAY_PUBLIC_KEY, Constant.SIGN_TYPE);
//		//创建API对应的request
//		AlipayTradePagePayRequest alipayRequest =  new  AlipayTradePagePayRequest();
//		alipayRequest.setReturnUrl(Constant.RETURNURL);
//		//在公共参数中设置回跳和通知地址
//		alipayRequest.setNotifyUrl(Constant.NOTIFYURL);
//		String outTradeNo = RandomUtil.randomNumbers(15);
//		String totalAmount = "88.8";
//		alipayRequest.setBizContent( "{"  +
//				"    \"out_trade_no\":\""+outTradeNo+"\","  +
//				"    \"product_code\":\"FAST_INSTANT_TRADE_PAY\","  +
//				"    \"total_amount\":"+totalAmount+","  +
//				"    \"subject\":\"Iphone6 16G\","  +
//				"    \"body\":\"Iphone6 16G\","  +
//				//	                "    \"passback_params\":\"merchantBizType%3d3C%26merchantBizNo%3d2016010101111\","  +
//				"    \"extend_params\":{"  +
//				"    \"sys_service_provider_id\":\"2088511833207846\""  +
//				"    }" +
//				"  }" );
//		//填充业务参数
//		String form= "" ;
//		try  {
//			//调用SDK生成表单
//			form = alipayClient.pageExecute(alipayRequest).getBody();
//		}  catch  (AlipayApiException e) {
//			e.printStackTrace();
//		}
//		httpResponse.setContentType( "text/html;charset="  +  Constant.CHARSET);
//		//直接将完整的表单html输出到页面
//		httpResponse.getWriter().write(form);
//		httpResponse.getWriter().flush();
//		httpResponse.getWriter().close();
//	}
//
//}